<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="display" uri="http://displaytag.sf.net"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Search Student Info</title>
</head>
<body>
	<h2>Search Student</h2>
	<s:form action="searchStudentAction">

		<s:textfield name="findName" label="Name" value="" />
		<s:submit value="Search" />
	</s:form>
	<br />

	<s:if test="listStudent.size() > 0">
		<h2>Results</h2>
		<table border="1px" cellpadding="8px">
			<tr>

				<th>Name</th>
				<th>Address</th>
				<th>Birthday</th>
				<th>Email</th>
				<th>Class</th>
				<th>Update</th>
				<th>Delete</th>
				<th>View</th>
			</tr>
			<s:iterator value="listStudent" status="userStatus">
				<tr>

					<td><s:property value="studentName" />
					</td>
					<td><s:property value="address" />
					</td>
					<td><s:date name="birthday" format="dd/MM/yyyy" />
					</td>
					<td><s:property value="email" />
					</td>
					<td><s:property value="classStudent.className" />
					</td>
					<td><s:url action="prepareUpdateAction.action" var="urlTag">
							<s:param name="studentId">
								<s:property value="studentId" />
							</s:param>
						</s:url> <s:a href="%{urlTag}">Update </s:a></td>
					<td><s:url action="deleteStudentAction.action" var="deleteTag">
							<s:param name="studentId">
								<s:property value="studentId" />
							</s:param>
						</s:url> <s:a href="%{deleteTag}"
							onclick="if (!confirm('Are you sure you want to delete?')) return false;">Delete </s:a>
					</td>
					<td><s:url action="viewStudentAction.action" var="viewTag">
							<s:param name="studentId">
								<s:property value="studentId" />
							</s:param>
						</s:url> <s:a href="%{viewTag}">Detail </s:a>
					</td>
				</tr>
			</s:iterator>
		</table>
	</s:if>
	<s:elseif test="listStudent.size() == 0">
		Student info not found!
	</s:elseif>
	<!--<display:table id="listStudent" name="listStudent" pagesize="5">
		<s:set var="studentId" name="studentId"></s:set>
		<display:column property="studentName" title="Student name"
			sortable="true" media="html" group="1" />
		<display:column property="address" title="Address" sortable="true" />
		<display:column property="birthday" title="Date" sortable="true" />
		<display:column property="email" title="Email" sortable="true" />
		<display:column property="classStudent.className" title="Class" sortable="true" />
	
		<display:column>
			<a href='updateStudent.jsp?studentid=${studentId}'>Update</a>
		</display:column>

	</display:table>
-->
</body>
</html>